// Set up a collection to contain player information. On the server,
// it is backed by a MongoDB collection named "players".

Players = new Meteor.Collection("players");

// On server startup, create some players if the database is empty.
if (Meteor.isServer) {
  Meteor.startup(function () {
      console.log(Players.find().count());
    if (Players.find().count() === 0) {
      var names = ["Ada Lovelace",
                   "Grace Hopper",
                   "Marie Curie",
                   "Carl Friedrich Gauss",
                   "Nikola Tesla",
                   "Claude Shannon"];
      for (var i = 0; i < names.length; i++){
          console.log('insert');
          Players.insert({name: names[i], score: Math.floor(Random.fraction()*10)*5});
      }
    }
  });
}
